package com.splic.product.service.impl;

import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.splic.product.mapper.AccuAreaMapper;
import com.splic.product.domain.AccuArea;
import com.splic.product.service.AccuAreaService;
import org.springframework.transaction.annotation.Transactional;

/**
 * AccuWeather位置区域Service业务层处理
 * 
 * @author singe
 * @date 2024-04-22
 */
@Service
public class AccuAreaServiceImpl implements AccuAreaService
{
    @Autowired
    private AccuAreaMapper accuAreaMapper;

    /**
     * 查询AccuWeather位置区域
     * 
     * @param id AccuWeather位置区域主键
     * @return AccuWeather位置区域
     */
    @Override
    public AccuArea selectAccuAreaById(Long id)
    {
        return accuAreaMapper.selectAccuAreaById(id);
    }

    /**
     * 查询AccuWeather位置区域列表
     * 
     * @param accuArea AccuWeather位置区域
     * @return AccuWeather位置区域
     */
    @Override
    public List<AccuArea> selectPageList(AccuArea accuArea)
    {
        return accuAreaMapper.selectAccuAreaList(accuArea);
    }

    /**
     * 查询AccuWeather位置区域列表
     *
     * @param accuArea AccuWeather位置区域
     * @return AccuWeather位置区域
     */
    @Override
    public List<AccuArea> selectAccuAreaList(AccuArea accuArea)
    {
        return accuAreaMapper.selectAccuAreaList(accuArea);
    }

    /**
     * 新增AccuWeather位置区域
     * 
     * @param accuArea AccuWeather位置区域
     * @return 结果
     */
    @Override
    public int insert(AccuArea accuArea)
    {
        return accuAreaMapper.insert(accuArea);
    }

    /**
     * 修改AccuWeather位置区域
     * 
     * @param accuArea AccuWeather位置区域
     * @return 结果
     */
    @Override
    public int update(AccuArea accuArea)
    {
        return accuAreaMapper.update(accuArea);
    }


    /**
     * 删除AccuWeather位置区域信息
     * 
     * @param id AccuWeather位置区域主键
     * @return 结果
     */
    @Override
    public int deleteById(Long id)
    {
        return accuAreaMapper.deleteById(id);
    }
    /**
     * 修改AccuWeather位置区域
     *
     * @param accuArea AccuWeather位置区域信息
     * @return 结果
     */
    @Override
    @Transactional
    public int saveOrUpdate(AccuArea accuArea)
    {
        if(accuArea.getId() != null){
            accuArea.setUpdateTime(new Date());
            return accuAreaMapper.update(accuArea);
        }else{
            accuArea.setCreateTime(new Date());
            return accuAreaMapper.insert(accuArea);
        }
    }

    @Override
    public List<AccuArea> selectAccuList(AccuArea accuArea) {
        List<AccuArea> list = this.selectAccuAreaList(accuArea);
        if (list == null || list.size() == 0) {

        }
        return null;
    }
}
